home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / Extras / ODE / deck < prev    next >
Encoding:
Text File  |  1991-10-24  |  576 b   |  37 lines

  1. \ Model deck of cards.
  2. \
  3. \ Author: Phil Burk
  4. \ Copyright 1986 -  Phil Burk, Larry Polansky, David Rosenboom.
  5. \ All Rights Reserved
  6. \
  7. \ MOD: PLB 8/18/87 Remove card after being dealt to prevent
  8. \      endless search.
  9.  
  10. MRESET DEAL:
  11. ANEW TASK-DECK
  12.  
  13. METHOD DEAL:
  14. METHOD SHUFFLE:
  15.  
  16. :CLASS OB.DECK <SUPER OB.LIST
  17.  
  18. :M DEAL:  ( -- index )
  19.     many: self ?dup
  20.     IF  choose
  21.         dup at: self
  22.         swap remove: self  ( repack deck )
  23.     ELSE
  24.         " DEAL: OB.DECK" " No More Cards Left!"
  25.         er_fatal ob.report.error
  26.     THEN
  27. ;M
  28.  
  29. :M SHUFFLE: ( -- )
  30.     clear: self
  31.     limit: self 0
  32.     DO i add: self
  33.     LOOP
  34. ;M
  35.  
  36. ;CLASS
  37.